const reverse = arr => arr.reverse();
const first = arr => arr[0];
const toUpper = s => s.toUpperCase();

// function compose(...args) {
//   console.log(args);
//   return function (value) {
//     return args.reverse().reduce((acc, currentFn) => currentFn(acc), value);
//   }
// }

const compose = (...args) => ((value) => args.reverse().reduce((acc, curFn) => curFn(acc), value));

const arr = ['one', 'two', 'three'];
let fn = compose(toUpper, first, reverse);
let ans = fn(arr);
console.log(ans);
